#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=100050;
const int M=100050;
int n,m,u,v,Min;
int cnt,head[N];
struct Edge{
    int to,next;
}edge[M];
int t[N],f[N];
void init(){
    cnt=0;
    memset(head,-1,sizeof(head));
    memset(t,0,sizeof(t));
    memset(f,0,sizeof(f));
    Min=0x3f3f3f3f;
}
void addEdge(int u,int v){
    edge[cnt].to=v;
    edge[cnt].next=head[u];
    head[u]=cnt++;
    edge[cnt].to=u;
    edge[cnt].next=head[v];
    head[v]=cnt++;
}
void dfs(int u,int p){
    t[u]=1;
    for(int i=head[u];i!=-1;i=edge[i].next){
        int v=edge[i].to;
        if(v==p){
            continue;
        }
        dfs(v,u);
        t[u]+=t[v];
    }
    int &ans=f[u]=n-t[u];
    for(int i=head[u];i!=-1;i=edge[i].next){
        int v=edge[i].to;
        if(v==p){
            continue;
        }
        ans=max(ans,t[v]);
    }
    Min=min(Min,ans);
}
int main(void){
    int t;
    scanf("%d",&t);
    while(t--){
        scanf("%d",&n);
        init();
        for(int i=0;i<n-1;i++){
            scanf("%d%d",&u,&v);
            addEdge(u,v);
        }
        dfs(1,-1);
        for(int i=1;i<=n;i++){
            if(f[i]==Min){
                printf("%d ",i);
            }
        }
        printf("\n");
    }
    return 0;
}